import java.io.IOException;

import org.jruby.*;

import org.jruby.runtime.load.BasicLibraryService;
import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.runtime.*;
import org.jruby.javasupport.JavaUtil;

public class GosuService implements BasicLibraryService {
  public boolean basicLoad(Ruby runtime) throws IOException {
    String path = getClass().getClassLoader().getResource("gosu.jar").getPath();
    path = path.substring(0, path.lastIndexOf("gosu.jar") - 1);
    LibPathHacker.addDir(path); // w00t!

    runtime.defineModule("Gosu");
    WindowProxy.createWindowClass(runtime);
    ImageProxy.createImageClass(runtime);
    ColorProxy.createColorClass(runtime);
    GosuProxy.createGosuMethods(runtime);
    FontProxy.createFontClass(runtime);
    SampleProxy.createSampleClass(runtime);
    SampleInstanceProxy.createSampleInstanceClass(runtime);
    SongProxy.createSongClass(runtime);
    TextInputProxy.createTextInputClass(runtime);
    return true;
  }
}
